import React, { PureComponent } from 'react'
import { View } from '@tarojs/components'
import './UserCardPlaceholder.scss'

export default class UserCardPlaceholder extends PureComponent {
  renderCard = () => {
    const { count = 1 } = this.props
    return [...Array(count)].map((item, index) => (
      <View className="userCardPlaceholder" key={index.toString()}>
        <View className="avatar skeleton-blink" />
        <View className="user-info">
          <View className="row row-half skeleton-blink" />
          <View className="row skeleton-blink" />
        </View>
      </View>
    ))
  }

  render() {
    return (
      <View className="userCardPlaceholderContainer">
        {this.renderCard()}
      </View>
    )
  }
}
